package com.gxa.saas.service.impl;

import com.gxa.saas.mapper.VendorMapper;
import com.gxa.saas.pojo.Vendor;
import com.gxa.saas.service.VendorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service("VendorService")
public class VendorServiceImpl implements VendorService {
    @Autowired
    VendorMapper vendorMapper;


    @Override
    public List<Vendor> selectByPage(Integer page, Integer limit) {
        return this.vendorMapper.selectByPage((page-1) * limit,limit);
    }

    @Override
    public List<Vendor> selectByNameOrContactperson(Map map) {
        return vendorMapper.selectByNameOrContactperson(map);
    }

    @Override
    public Integer inert(Vendor vendor) {
        return vendorMapper.insert(vendor);
    }

    @Override
    public void delete(Integer id) {
        vendorMapper.delete(id);
    }

    @Override
    public void update(Vendor vendor) {
        vendorMapper.update(vendor);
    }

    @Override
    public List<Vendor> selectAll() {
        List<Vendor> vendors = vendorMapper.selectAll();
        return vendors;
    }
}
